from tortoise.models import Model
from tortoise import fields


class BaseModel(Model):
    id = fields.BigIntField(pk=True, index=True)
    created_by = fields.CharField(
        max_length=50, null=True, default="admin", description="创建者"
    )
    updated_by = fields.CharField(
        max_length=50, null=True, default="admin", description="更新者"
    )
    created_at = fields.DatetimeField(auto_now_add=True, description="创建时间")
    updated_at = fields.DatetimeField(auto_now=True, description="更新时间")
    deleted = fields.BooleanField(default=False, description="逻辑删除标志")

    class Meta:
        abstract = True